let phonenumber=0;
const  validatedeptname =(rule, value, callback)=>{
      let j=0;
    let number=0;
     if(value.length>1200){
         callback(new Error('长度为0-1200个字符'))
    } else {
        for (var i = 0; i <= value.length; i++) {

            if ((value[i] >= '0' && value[i] <= '9')) {
                if(number==0&&value[i]!='1'){
                    callback(new Error('请输入1开头的电话号码'))
                }
                number++;
            } else if (value[i] === ','||value[i]==='，') {
                if (number <= 10 ) {
                    callback(new Error('请输入正确的11为手机号码'))
                }
                number = 0;
            }
            if((value[i]<'0'||value[i]>'9')&&(value[i]!=','&&value[i]!='，')){
                callback(new Error('请输入数字或者,'))
            }
            if(number>11){
                callback(new  Error('请使用,分隔符'))
            }
        }
        if (number < 11 && number > 0) {
            callback(new Error('请输入正确的11为手机号码'))
        }else {
            callback()
        }
    }
}


export const tableOption = {
    "border": true,
    "index": true,
    "indexLabel": "序号",
    "stripe": true,
    "menuAlign": "center",
    "align": "center",
    "searchMenuSpan": 6,
    "viewBtn": false,


    //以下三个button隐藏了，测试时改成true值即可。
    // 'addBtn':false,
    // 'delBtn':false,
    // 'editBtn':false,
    "column": [

        {
            "type": "select",
            "label": "短信类型",
            "prop": "smsType",
            "search": false,
            "dicData":utils.getDict('sms_type'),
            addDisplay:false,
           /* rules: [{
                required: true,
                message: '请选择短信类型',
                trigger:['blur','change']
            }]*/
        },
        {
            "type": "textarea",
            "label": "接收人",
            "prop": "receiveName",
            "search": true,
            minRows:2,
            maxlength:1200,
            showWordLimit:true,
            rules: [
                {
                required: true,
                message: '请输入接收人',
                trigger: 'blur'
                },
                // {
                //     validator: validname,
                //     trigger:['blur','change']
                // },
                // {
                //     validator:baocuojiechu,
                //     trigger:['blur']
                // }
            ]
        },
        {
            "type": "textarea",
            "label": "手机号",
            "prop": "receiveMobile",
            "search": true,
            minRows:2,
            maxlength:1200,
            showWordLimit:true,
            rules: [
                {
                    required: true,
                    message: '请输入手机号',
                    trigger: 'blur'
                },
                {
                    validator: validatedeptname,
                    trigger:['blur', 'change']
                }
            ]
        },
        {
            "type": "textarea",
            "label": "短信内容",
            "prop": "smsContent",
            "search": false,
            minRows:2,
            maxlength:225,
            showWordLimit:true,
            rules: [
                {
                    required: true,
                    message: '请输入短信内容',
                    trigger: 'blur'
                },
                {
                    min:0,
                    max:225,
                    message:'长度在 0 到 225 个字符',
                    trigger:'blur'
                }
            ]
        },
        {
            "type": "select",
            "label": "发送状态",
            "prop": "smsStatus",
            "search": true,

            /*默认值设置：value*/
            // "value":"0",
            /*增加时隐藏设置：*/
            addDisplay:false,


            "dicData":  utils.getDict('smsSStatus'),
           /* rules: [
                {
                    required: true,
                    message:'请选择发送状态',
                    trigger:['blur','change']
                },
            ]*/
        },
        {
            "type": "datetime",
            "label": "发送时间",
            "prop": "sendTime",
            format: 'yyyy-MM-dd HH:mm:ss',
            valueFormat: 'yyyy-MM-dd HH:mm:ss',
            "search": false,
          /*  rules: [
                {
                    required: true,
                    message: '请输入发送时间',
                    trigger: 'blur'
                },
            ]*/
        },



          ]
}
